package com.qf.springmvc;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/liyao")
public class TestController {
    @RequestMapping("/test1")
    public void test1(HttpServletRequest req){
        String username = req.getParameter("username");
        String password = req.getParameter("password");
        System.out.println(username+"---------------->"+password);
    }
    @RequestMapping("/test2")
    public void test2( String username,String password){
        System.out.println(username+"=================>"+password);
    }
    @RequestMapping("/test3")
    public void test3(@RequestParam(name="username") String name, @RequestParam(name="password") String pwd,@RequestParam(defaultValue = "18",required = false)String age){
        System.out.println(name+"=================>"+pwd);
    }
}
